<?php
class Application_Model_Colleges extends Zend_Db_Table{
	protected $_name = 'colleges';

	public function getSelect( $_university_id = 0 ){
		try{
			$sql = $this->select()->setIntegrityCheck(false)
						->from($this->_name, array('id', 'name'));
			if ( $_university_id )
				$sql->where('(university_id = ? OR university_id=0)' , $_university_id);
			else
				$sql->where('university_id=0');
			$sql->where('deleted = 0');

			$result = $this->getAdapter()->fetchPairs($sql);

			if( $result )
				return $result;
			else
				return array();
		}
		catch(Zend_Exception $e){
			return array();
		}
	}

}